<!DOCTYPE html >
<html>

	<head>
	
		<meta charset="UTF-8">
		<meta content="telephone=no,email=no,address=no" name="format-detection" />
		
		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<title>会员登录</title>
		<meta http-equiv="keywords" content="登录{$web_name}" />
		<meta name="description" content="登录{$web_name}" />

		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
		<link rel="stylesheet" type="text/css" href="/themes/wnsc_moblie/newMobile/User/login/css/public.css" />
		<link rel="stylesheet" type="text/css" href="/themes/wnsc_moblie/newMobile/User/login/css/login.css" />
		<script type="text/javascript" src="/themes/wnsc_moblie/newMobile/User/login/js/jquery.js"></script>
		<script src="/themes/wnsc_moblie/newMobile/User/login/js/global.js"></script>
		<script src="/themes/wnsc_moblie/newMobile/User/login/js/mobile_common.js"></script>
		<script type="text/javascript" src="/themes/wnsc_moblie/newMobile/User/login/js/mobile/layer.js"></script>
		<style type="text/css">
			.nk_logo {
			    display: block;
			    text-align: center;
			    line-height: 140px;
			}
			.nk_logo img {
			    display: inline-block !important;
			    vertical-align: middle !important;
			    width: 100% !important;
			    height: auto !important;
			    max-height: 100%;
			}
			.nk_logo .back-home {
			    position: absolute;
			    z-index: 80;
			    width: 30px;
			    height: 25px;
			    line-height: 25px;
			    background: #fff;
			    top: 15px;
			    padding-right: 8px;
			    border-top-right-radius: 18px;
			    border-bottom-right-radius: 18px;
			    text-align: center;
			}
			.nk_logo .back-home span.data-home {
			    height: 20px;
			    width: 20px;
			    display: block;
			    background: url(/themes/wnsc_moblie/newMobile/User/login/images/home_check.png) center no-repeat;
			    background-size: 20px 20px;
			    margin: 2px 0 0 8px;
			}
		</style>
		<php>
			$agent=$_SERVER['HTTP_USER_AGENT'];
			if(strpos($agent,"Html5Plus")> -1){
		</php>
		<script type="text/javascript">
		var auths=null;
		// 监听plusready事件  
		document.addEventListener( "plusready", function(){
			// 扩展API加载完毕，现在可以正常调用扩展API
			plus.oauth.getServices( function(services){
				auths = services;
			}, function(e){
				document.getElementById('weixin_login').style.display='none';
			} );
		}, false );
		</script>
		<php>
		}
		</php>
	</head>

	<body style="width: 100%;overflow: hidden;">
	<?php
				$agent = $_SERVER['HTTP_USER_AGENT'];
				if(strpos($agent,"Html5Plus") === false){
			?>
		<header id="header" class='header'>
			<div class="h-left">
				<a href="javascript:history.back(-1)" class="sb-back"></a>
			</div>
			<div class="h-mid">会员登录 </div>
		</header>
	<?php
				}
			?>
		<div class="nk_logo">
			<img src="/themes/wnsc_moblie/newMobile/User/login/images/login.png">
			
		</div>
		<div class="denglu">
			<form action="" method="post">
				<div class="Login">
					<dl>
						<dt>用户名：</dt>
						<dd><input type="text" name="username" id="username" placeholder="请输入手机号" value="" /></dd>
					</dl>
					<dl style=" margin-top:15px;">
						<dt>密码：</dt>
						<dd><input type="password" name="password" id="password" placeholder="密码" /></dd>
					</dl>
					<div class="field submit-btn">
						<input type="button" class="btn_big1" onClick="checkSubmit()" value="登 录" />
					</div>
					<div class="ng-foot">
						<div class="ng-cookie-area">
							<label class="bf1 login_ffri">
								<input type="checkbox" name="remember" value="1" checked=""> &nbsp;自动登录 
							</label>
						</div>
						<div class="ng-link-area">
							<span style=" margin-right:5px; border-right:1px solid #eeeeee">
			                  <a href="{:U('user/register')}" >免费注册</a>
			                </span>
							<span class="user_line"></span>
							<span>
			                  <a href="{:U('user/forget_pwd')}" >忘记密码？</a>
							<php>
								$agent=$_SERVER['HTTP_USER_AGENT'];
								if(strpos($agent,"Html5Plus")> -1){
							</php>							  
							   <!-- <a href="/1.html" >111</a> -->
							   <php>
								}
							</php>	
							</span>
						</div>
						
						<div class="third-area ">
							<div class="third-area-a">第三方登录</div>
							<php>
								$isweixin=is_weixin();
								if($isweixin){
							</php>
							<a class="ta-weixin" href="{:U('user/weixin_login')}" title="weixin"></a>
							<php>}</php>
							<php>
								$agent=$_SERVER['HTTP_USER_AGENT'];
								if(strpos($agent,"Html5Plus")> -1){
							</php>
							   <a class="ta-weixin" onclick="login('weixin')"></a>
							   <!--<a class="ta-qq" onclick="login('qq')"></a>-->
							<a class="ta-qq" href="{:U('user/app_qq_login')}"  title="QQ" ></a>
						       <a class="ta-weibo" onclick="login('sinaweibo')"></a> 
							<php>}else{</php>
							<a class="ta-weibo" href="https://api.weibo.com/oauth2/authorize?client_id=<?=C('wb_login.WEIBO_APP_KEY')?>&redirect_uri=<?=C('wb_login.WEIBO_MOBLIE_URL')?>&response_type=code&code=<?=md5(time())?>" title="weibo"></a>
							<a class="ta-qq" href="{:U('user/qqlogin')}"  title="QQ" ></a>
							
							<php>}</php>
						
						</div>
					
					</div>
				</div>
			</form>
		</div>
		<script type="text/javascript">
			function checkSubmit() {

				var username = $.trim($('#username').val());
				var password = $.trim($('#password').val());
				var referurl = $('#referurl').val();
				if(username == '') {
					showErrorMsg('用户名不能为空!');
					return false;
				}
				if(!checkMobile(username)) {
					showErrorMsg('账号格式不匹配!');
					return false;
				}
				if(password == '') {
					showErrorMsg('密码不能为空!');
					return false;
				}

				if($.trim($('#verify_code').val()) == '') {

				}

				$.ajax({
					type: 'post',
					url: '/user/login_in',
					data: {
						phone: username,
						password: password
					},
					dataType: 'json',
					success: function(res) {
						if(res.code == 0) {
							showErrorMsg(res.message);
						}
						if(res.code == 1) {
							showErrorMsg(res.message);
							setTimeout('location.href="' + res.data + '";', 1000)
						}

					},
					error: function(XMLHttpRequest, textStatus, errorThrown) {
						showErrorMsg('网络失败，请刷新页面后重试');
					}
				})
			}

			function checkMobile(tel) {
				var reg = /(^1[3|4|5|7|8][0-9]{9}$)/;
				if(reg.test(tel)) {
					return true;
				} else {
					return false;
				};
			}

			function checkEmail(str) {
				var reg = /^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
				if(reg.test(str)) {
					return true;
				} else {
					return false;
				}
			}

			function showErrorMsg(msg) {

				layer.open({
					content: msg,
					time: 2
				});
			}
		</script>
		
		<script src="/themes/wnsc_moblie/newMobile/Shop/js/jquery.js"></script>
		<php>
			$agent=$_SERVER['HTTP_USER_AGENT'];
			if(strpos($agent,"Html5Plus")> -1){
		</php>
		<script>
			function login(type){
			  var s = auths[0];
              var s1 = auths[1];
              var s2 = auths[2];             
              if(s.id=='xiaomi'){
              	 var s3 = auths[3];
                 if(s3.id==type){
                  var k=s3;
                }
              }
			  if(s.id==type){
              	var k=s;
              }
              if(s1.id==type){
              	var k=s1;
              }
              if(s2.id==type){
              	var k=s2;
              }
             
             if ( !k.authResult ) {
					showErrorMsg("登录中...");
					k.login( function(e){
						k.getUserInfo( function(e){
						    	if(type=='qq'){
                                    var userInfo=JSON.stringify(k.userInfo);
								}else{
                                    var userInfo=JSON.stringify(k.userInfo);
								}
								other(type,userInfo);
							}, function(e){
								alert( "获取用户信息失败："+e.message+" - "+e.code );
							} );
					}, function(e){
						alert( "登录认证失败！" );
					} );
				}else{
					k.getUserInfo( function(e){
						var userInfo=JSON.stringify(k.userInfo);
						other(1,userInfo);
					}, function(e){
						alert( "获取用户信息失败："+e.message+" - "+e.code );
					} );
				}
			}
			
		
			function other(type,userInfo){
			    if(type=='qq'){
			        var p_url='/user/qq_app_login';

				}
                if(type=='weixin'){
                    var p_url='/user/wx_app_login';
                }
                if(type=='sinaweibo'){
                    var p_url='/user/wb_app_login';
                }


				$.ajax({
					type: 'post',
					url: p_url,
					data: {
						userInfo: userInfo,
					},
					dataType: 'json',
					success: function(res) {
						if(res.code == 0) {
							showErrorMsg(res.message);
						}
						if(res.code == 1) {
							showErrorMsg(res.message);
							setTimeout('location.href="' + res.data + '";', 1000)
						}

					},
					error: function(XMLHttpRequest, textStatus, errorThrown) {
						showErrorMsg("<br/>"+XMLHttpRequest.status+"<br/>"+XMLHttpRequest.readyState+"<br/>"+XMLHttpRequest.responseText);
					}
				})
			}

		</script>
		<php>}</php>
	</body>

</html>